package com.bruan.Stream;

import java.util.*;
import java.util.stream.Stream;

public class StreamTest2 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        Collections.addAll(list,"dwdw","wdw");
        //1. 获取list 和 set的流对象
        Stream<String> stream = list.stream();
        //2. 获取map的流对象
        Map<String,Integer> map = new HashMap<>();
        map.put("迪丽热巴",11);
        map.put("迪丽热巴2",11);
        map.put("迪丽热巴3",11);
        map.put("迪丽热巴4",11);
        map.put("迪丽热巴5",11);
        ///2.1 分开
        Stream<String> keys = map.keySet().stream();
        Stream<Integer> vals = map.values().stream();
        ///2.2 集合
        Set<Map.Entry<String, Integer>> entries = map.entrySet();
        Stream<Map.Entry<String, Integer>> kvs= entries.stream();
        kvs.filter(s->s.getKey().contains("巴")).forEach(e-> System.out.println(e.getKey()+"==>"+e.getValue()));
        //3.获取数组的流对象
        String[] arr = {"xx","sss"};
        Stream<String> s = Arrays.stream(arr);
        Stream<String> s2 = Stream.of(arr);



    }
}
